home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: Larry Weiss <lfw@iadfw.net>
- Newsgroups: comp.lang.c
- Subject: Re: Newbie Questions
- Date: Sat, 23 Mar 1996 21:56:42 -0600
- Organization: customer of Internet America
- Message-ID: <3154C7FA.B38@iadfw.net>
- References: <4irpc1$b8u@GRAPEVINE.LCS.MIT.EDU> <4isgta$7cr@newsbf02.news.aol.com> <827628456snz@genesis.demon.co.uk>
- NNTP-Posting-Host: dal12-25.ppp.iadfw.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (Win16; I)
-
- Lawrence Kirby wrote:
- >
- > In article <4isgta$7cr@newsbf02.news.aol.com>
- > mvaccaro1@aol.com "MVaccaro1" writes:
- > >try this little test and tell me what happens:
- > >
- > >main( )
- > > {
- > > char *s1 = "hello";
- > > char s2[ ] = "hello";
- > >
- > > printf( "Sizeof s1 %d\n Sizeof s2 %d\n", sizeof s1, sizeof s2 );
- >
- > Anything can happen since sizeof doesn't return an int value, it returns
- > a value with some implementation specific unsigned type (size_t). The
- > correct way to write this is:
- >
- > printf( "Sizeof s1 %lu\n Sizeof s2 %lu\n", (unsigned long) sizeof s1,
- > (unsigned long) sizeof s2 );
- > > return 0;
- > > }
- >
-
- Since printf() is a member of the standard library (with unambiguous semantics)
- couldn't the implementation be required to issue a diagnostic if a mismatch
- were attempted? If so, would the Standard need to say so explicitly?
-
- The information is clearly available to the implementation to support an
- unambiguous diagnostic.
-